package cate.game.activity.customwarorder.msg;

import cate.common.util.GameResult;
import cate.game.GameBody;
import cate.game.activity.customwarorder.RoleCustomWarOrder;
import cate.game.client.ClientContext;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBCustomWarOrder;
import cate.game.client.msg.id.MsgIdBWarOrder;
import easy.java.dev.note.NoteField;

public class CustomWarOrderChooseReq implements MsgInput {
    @NoteField("功能ID")
    public int funcId;
    @NoteField("自选奖励tid")
    public int chooseTid;
    @Override
    public void execute(GameBody game, ClientContext cc) {
        RoleCustomWarOrder r = cc.getRole().getActivity().getEnableActivitySingle(funcId);
        if (r == null) {
            cc.getRole().getGame().notice.message(cc.getRole(), "活动未开启");
            return;
        }
        GameResult<Void> res = r.choose.choose(chooseTid);
        game.notice.message(cc.getRole(), res, true);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBCustomWarOrder.CHOOSE_REQ;
    }
}
